﻿using STT.DataAccess;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;

namespace STT.Business
{
    public class BTbChucNang
    {
        public static DataTable SelectByMaCNCha(string MaCNCha)
        {
            SqlParameter[] pr = new SqlParameter[1];
            pr[0] = new SqlParameter(@"MaCNCha", MaCNCha);
            DataTable all = SqlHelper.ExecuteData(CommandType.StoredProcedure, "TbChucNang_SelectByMaCNCha", pr);
            return all;
        }
        public static DataTable SelectAll()
        {
            DataTable all = SqlHelper.ExecuteData(CommandType.StoredProcedure, "TbChucNang_SelectAll", null);
            return all;
        }

        public static DataTable LayChucNangTheoQuyen(string MaQuyen)
        {
            SqlParameter[] pr = new SqlParameter[1];
            pr[0] = new SqlParameter(@"MaQuyen", MaQuyen);
            //pr[1] = new SqlParameter(@"ChucNang",SqlDbType.VarChar);
            //pr[1].Direction = ParameterDirection.Output;
            //pr[1].Size = 1000;
            DataTable all=SqlHelper.ExecuteData(CommandType.StoredProcedure, "LayChucNangTheoQuyen", pr);
            return all;
        }

        public static void Delete(int MaCN)
        {
            SqlParameter[] pr = new SqlParameter[1];
            pr[0] = new SqlParameter(@"MaCN", MaCN);
            SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "TbChucNang_Delete", pr);
        }
    }
}